/**
 * Copyright 2008 Adam Ruggles.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package kiff.enumerator;

/**
 * Role Status Enumerator.
 * @author Adam
 * @version $Id: RoleStatus.java 38 2008-09-21 07:40:51Z a.ruggles $
 */
public enum RoleStatus implements GenericEnum<Byte> {
	/**
	 * Define the active status value.
	 */
    ACTIVE((byte) 1, "Active"),
	/**
	 * Define the disabled status value.
	 */
    DISABLED((byte) 0, "Disabled"),
	/**
	 * Define the required status value.
	 */
    REQUIRED((byte) 2, "Required");

    /**
     * Returns a <code>Status</code> for a given byte value.
     * @param value The byte value.
     * @return A <code>Status</code>.
     */
    public static RoleStatus fromValue(final Byte value) {
        switch (value) {
        case 0: return DISABLED;
        case 1: return ACTIVE;
        case 2: return REQUIRED;
        default: return DISABLED;
        }
    }

    /**
     * Label.
     */
    private String label;

    /**
     * Byte value.
     */
    private byte value;

    /**
     * Constructor.
     * @param value The value.
     * @param label The label.
     */
    private RoleStatus(final Byte value, final String label) {
        this.value = value;
        this.label = label;
    }

    /**
     * Returns the label for this status (Used for displaying).
     * @return The label.
     */
    public String getLabel() {
        return label;
    }

    /**
     * Returns the byte value.
     * @return The byte value.
     */
    public Byte getValue() {
        return value; 
    }
}
